package com.boss;

import com.boss.annotation.EnableDiscoveryClientBridge;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.concurrent.Executor;

@EnableAspectJAutoProxy(exposeProxy=true)
@SpringBootApplication(scanBasePackages={"com.boss"}, exclude={FreeMarkerAutoConfiguration.class})
@EnableTransactionManagement
@EnableDiscoveryClientBridge
@EnableDiscoveryClient
@EnableAsync
public class SalaryApplication {

    public static void main(String[] args) {
        SpringApplication.run(SalaryApplication.class, args);
        System.out.println("工资信息服务启动成功");
    }

//    @Bean
//    public TomcatServletWebServerFactory servletContainer() {
//        return new TomcatServletWebServerFactory ();
//    }
    @Bean(name = "threadPoolTaskExecutor")
    public Executor threadPoolTaskExecutor() {
        return new ThreadPoolTaskExecutor();
    }

}
